﻿CREATE PROCEDURE [dbo].[AddMediaStock]
	@StockId INT,
	@MediaDefId INT,
	@StationNumber INT
AS

INSERT INTO MediaStock
(StockID, MediaDefID, PublishDate, StationNumber)
VALUES
(@StockId, @MediaDefId, GETDATE(), @StationNumber)

SELECT Stock.StockId, Code, [Description], [Weight], SizeX, SizeY, Facing, Colour, Stock.StockTypeId, StockType, MediaStockId, MediaDefId, PublishDate, StationNumber
FROM dbo.MediaStock
INNER JOIN dbo.Stock ON MediaStock.StockID = Stock.StockID
INNER JOIN dbo.StockType ON StockType.StockTypeID = Stock.StockTypeID
WHERE MediaStockID = SCOPE_IDENTITY()